<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/js/jquery.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/bootstrap.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/bootstrap.min.css");

Yii::app()->clientScript->registerCss("CSS1","
    .cont_box img{
        height: 200px;
    }

   #loadings {
        left: 50%;
        position: absolute;
        top: 50%;
    }

");


?>
<style type="text/css">
    .main-box {

        height: 100%;
        left: 0;
        margin: 0 auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: -1;
    }
    .morcon {
        height: 100px;
        margin: 245px 20px 20px;
        position: relative;
        text-align: center;
    }

    .morcon .reg {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        font-size: 20px;
        left: 4%;
        position: absolute;
        top: 0;
    }
    .morcon .login {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        display: block;
        font-size: 20px;
        left: 51%;
        position: absolute;
        top: 39%;
    }

    .wrap .header{
        width: 100%;
        position: relative;
        height: 300px;
    }
    .wrap .footer {
        height: 300px;
        position: relative;
        width: 100%;
    }

    .wrap .header .mydodo{
        background: url("<?php echo $this->staticsPath."/img/mydodo.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 40px;
        width: 150px;
        position: absolute;
        right: 15px;
        top: 25px;
    }
    .wrap .header .imgbg{
        background: url("<?php echo $this->staticsPath."/img/imgbg.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 150px;
        width: 150px;
        position: absolute;
        left: 15px;
        top: 90px;
    }
    .imgbg .box{
        width: 100%;
        height: 100%;
        position: relative;
    }
    .imgbg .box img {
        border-radius: 50%;
        height: 80%;
        left: 15px;
        position: absolute;
        top: 15px;
        width: 80%;
    }
    .wrap .header .hname {
        height: 200px;
        left: 170px;
        position: absolute;
        top: 144px;
        width: 200px;
    }
    .wrap .header .hname p{
        color: #0066b3;
        font-size: 20px;
    }
    .wrap .header .list {


        height: 80px;
        left: 25px;
        position: absolute;
        top: 25px;
        width: 80px;
    }
    .wrap .header .list a{
        color: #0066b3;
        font-size: 30px;
    }
    .wrap .footer .fbotton{
        width: 33%;
        height: 150px;
        float: left;
    }
    .wrap .footer .fbotton .like{
        background: url("<?php echo $this->staticsPath."/img/mylike.png" ?>") no-repeat scroll 13px 0 / 90px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .collection{
        background: url("<?php echo $this->staticsPath."/img/mycollection.png" ?>") no-repeat scroll 13px 0 / 104px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .share{
        background: url("<?php echo $this->staticsPath."/img/share.png" ?>") no-repeat scroll -2px 15px / 114px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .point{
        background: url("<?php echo $this->staticsPath."/img/point.png" ?>") no-repeat scroll 6px 0 / 104px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointlist{
        background: url("<?php echo $this->staticsPath."/img/pointlist.png" ?>") no-repeat scroll 13px 0 / 90px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointgift{
        background: url("<?php echo $this->staticsPath."/img/pointgift.png" ?>") no-repeat scroll 13px 11px / 90px auto;
        height: 100%;
        width: 100%;
    }
    body{
        background: #f4f4f4 none repeat scroll 0 0;
    }
    .topban{
        padding: 0 10px
    }
    .topban .top {
        color: #888;
        height: 20px;
        left: 50%;
        line-height: 20px;
        margin: -10px 0 52px -30px;
        position: absolute;
        top: 50%;
    }
    .topban .top.name {
        margin-top: -30px;
    }
    .topban .top.num {
        margin-top: -5px;
    }
    .topban .top.subject {
        margin-top: 20px;
    }
    #logout{
        color: #ffffff;
        font-size: 18px;
    }
    #logout:hover{
        color: #ffffff;
    }
    .lgt{
        width: 90%;
        height: 50px;
        text-align: center;
        margin: 20px auto 0 auto;
        margin-bottom: 50px;
        background: rgb(231,66,60);
        border-radius: 8px;
        line-height: 50px;
    }
    .right{
        float: right;
        margin-top: 10px;
    }
    .wrap .fa{
        width: 36px;
    }
    section a {
        color:#999
    }
    .modl_tel {
        background: #ffffff none repeat scroll 0 0;
        border-bottom: 1px solid #ccc;
        height: 60px;
        line-height: 60px;
        margin: 10px 0;
        padding-left: 10px;
    }
    .topban {
        padding: 0 10px;
    }
    .topban {
        background-color: #ffffff;
        overflow: hidden;
        position: relative;
        width: 100%;
    }
    .topban {
        background: #fff none repeat scroll 0 0;
        height: 140px;
        overflow: unset;
        position: relative;
        width: 100%;
    }
    .status-people-pic {
        left: 0;
        margin-left: 15px;
        margin-top: -50px;
        position: absolute;
        top: 50%;
    }
    .stat-people {
        background: #fafafa none repeat scroll 0 0;
        border-radius: 30em;
        display: block;
        padding: 7px;
        position: relative;
        width: 100px;
    }
    .topban {
        overflow: unset;
        position: relative;
        width: 100%;
    }
    .nav {
        background: rgb(249, 249, 249) none repeat scroll 0 0;
        border-top: 1px solid #ddd;
        bottom: 0;
        opacity: 0.9;
        padding: 6px 0 !important;
        position: fixed;
        width: 100%;
        height: 55px;
    }
    .nav .nav-box {
        color: #333;
        float: left;
        font-size: 14px;
        text-align: center;
        width: 33%;
        height: 100%;
    }
    .nav .nav-box.actt{
        color: #068043;
    }
    .nav .nav-box {
        color: #333;
        float: left;
        font-size: 14px;
        height: 100%;
        text-align: center;
        width: 50%;
    }
    .topban {
        overflow: unset;
        padding: 20px;
        position: relative;
        width: 100%;
    }
    .child_zw{
        cursor:pointer;
    }
    .lgt.ok{
        width: 90%;
        height: 50px;
        text-align: center;
        margin: 20px auto 0 auto;
        margin-bottom: 50px;
        background: #068043;
        border-radius: 8px;
        line-height: 50px;
    }
    #sign{
        color: #ffffff;
        font-size: 18px;
    }
</style>

<div class="data">
    <header class="homeHder header">
        <?php if($aaa){ ?>
            <?php if(in_array("tk", $aaa)){ ?>
                <a style="width: 100px" id="refresh" href="javascript:void(0);">
                    <div style="cursor: pointer;margin-left: 10px;" class="hder_return flol">
                        <i class="fa fa-refresh" aria-hidden="true" style="font-size: 22px; margin-right: 5px;"></i>切换
                    </div>
                </a>
                <script type="text/javascript">
                    $(function(){
                        $("#refresh").click(function(){
                            if(window.confirm('你确定要切换成观察者吗？')){
                                window.location.href="<?php echo $this->createUrl('show',array('id'=>$id,'openid'=>$openid)) ?>";
                            }
                        })
                    });
                </script>
            <?php } ?>
        <?php } ?>




        <div class="hder_logo">课程观测</div>
        <div class="hder_urse flor"><a  id="logOut"  href="javascript:void(0);"><i class="fa fa-sign-out"></i></a></div>
        <script type="text/javascript">
            $(function(){
                $("#logOut").click(function(){
                    if(window.confirm('你确定要退出吗？')){
                        $.ajax({
                            type: "POST",
                            url: '<?php echo Yii::app()->createUrl('observation/logOut') ?>',
                            data: {
                                'openid':'<?php echo $openid ?>'
                            },
                            dataType: "json",
                            success: function (data) {
                                if (data) {
                                    if(data.status==1){
                                        window.location.reload();
                                    }else{
                                        alert(data.message);
                                        return false;
                                    }
                                }else{
                                    alert('操作失败');
                                    return false;
                                }
                            }
                        });
                    }
                });
            });
        </script>
    </header>
    <section class="wrap">
        <div class="topban pdX10">
           在课程正式开始之前，请所有听课老师和专家准时到指定教室就坐，并确认签到。所有老师签到完成后，课程将准时开始。
        </div>
        <section class="cont_wrpa">
            <?php if($signIn){ ?>
                <a id="sign" href="javascript:void(0);"><div class="lgt ok">已签到</div></a>
            <?php }else{ ?>
                <a id="sign" href="javascript:void(0);"><div class="lgt">确认签到</div></a>
            <?php } ?>

        </section>
    </section>
    <nav class="nav">
        <a href="javascript:void(0);" class="">
            <div class="nav-box actt">
                <i class="fa fa-book"></i>签到
            </div>
        </a>
        <?php if($open_info->jiaoan){ ?>
        <a href="<?php echo Yii::app()->params['webPath'].$open_info->jiaoan ?>" class="">
            <div class="nav-box">
                <i class="fa fa-home"></i>教案
            </div>
        </a>
        <?php }else{ ?>
        <a href="javascript:void(0)" class="">
            <div class="nav-box">
                <i class="fa fa-home"></i>教案
            </div>
        </a>
        <?php } ?>
    </nav>
</div>
<div class="modal fade" id="Xalert" data-id="1" tabindex="-1" role="dialog" aria-labelledby="linkModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <!-- 登陆页面注册提示 -->
        <div class="modal-content text-left">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">提示</h4>
            </div>
            <div class="modal-body">
                <p id="alertMassage"></p>
                <button type="button" style="margin-top: 20px" class="btn btn-primary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    <?php if($signIn){ ?>
    var setLock = true;
    <?php }else{ ?>
    var setLock = false;
    <?php } ?>
    function Xalert(html){
        $("#alertMassage").html(html);
        $("#Xalert").modal();
        setTimeout(function(){$("#Xalert").modal('hide')},2000);
    }

    <?php
    if($open_info->status ==0){
    ?>
    window.setInterval("loadMsg()",15000);//轮询
    var pagination = {
        oid:'<?php echo $open_info->id ?>'
    };
    function loadMsg(){
        if(setLock==true){
            var url = "<?php echo Yii::app()->createUrl('observation/ajaxMsg') ?>";
            var html = "";
            $.getJSON(url, pagination, function(jsondata){
                if(jsondata.status==1){
                    window.location.reload();
                    return false;
                }
            });
        }

    }
    <?php } ?>
    <?php
    if($open_info->status ==1){

    ?>
    window.setInterval("loadMsg1()",15000);//轮询
    var pagination1 = {
        oid:'<?php echo $open_info->id ?>'
    };
    function loadMsg1(){

            var url = "<?php echo Yii::app()->createUrl('observation/ajaxMsg1') ?>";
            $.getJSON(url, pagination1, function(jsondata){
                if(jsondata.status==1){
                    window.location.reload();
                    return false;
                }
            });


    }

    <?php } ?>

    <?php
    $Crole = Yii::app()->request->getParam('Crole');

    ?>

    $(function(){
        <?php if($signIn){ ?>
        var sign = true;
        <?php }else{ ?>
        var sign = false;
        <?php } ?>
        $("#sign").click(function(){
            if(sign==true){
                return false;
            }else{
                $.ajax({
                    type: "POST",
                    url: '<?php echo $this->createUrl('ajaxSignIn'); ?>',
                    data: {
                        oid:'<?php echo $open_info->id ?>',
                        uid:'<?php echo $uid ?>',
                        <?php if(in_array("zj", $aaa)){ ?>
                            type:'zj',
                        <?php }else{ ?>
                            type:'tk',
                        <?php } ?>
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            if(data.status==1){
                                sign = true;
                                setLock = true;
                                Xalert(data.message);
                                $(".lgt").addClass("ok");
                                $(".lgt").html('已签到');
                                window.location.reload();
                            }else{
                                Xalert(data.message);
                                return false;
                            }
                        }else{
                            Xalert('操作失败');
                            return false;
                        }
                    }
                });
            }
        });
    })
</script>
